package com.ligongmusic.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.WindowManager;

import com.ligongmusic.R;


/**
 * Created by Administrator on 2016/8/30.
 */
public class Welcome extends Activity {
    private Handler mHandler = new Handler()/*{
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            startActivity(new Intent(Welcome.this, MainActivity.class));
            finish();
        }
    }*/;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.welcome);
//        mHandler.sendEmptyMessageAtTime(0x1, 5000);
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                startActivity(new Intent(Welcome.this, MainActivity.class));
                finish();
            }
        }, 3000);
    }

    @Override
    protected void onResume() {
        super.onResume();
//        mHandler.sendEmptyMessageAtTime(0x1, 3000);
    }

    //    class MyTask extends TimerTask{
//        @Override
//        public void run() {
//            for (int i = 0; i < 3; i++){
//                SystemClock.sleep(1000);
//            }
//            Message.obtain(mHandler, 0x1).sendToTarget();
//        }
//    }
}
